//聊天消息模型
module.exports = (sequelize, Sequelize) => {
  return sequelize.define("Msg", {
    id: {
      type: Sequelize.UUID,
      notNull: true,
      primaryKey: true,
      defaultValue: Sequelize.UUIDV4 // 或 DataTypes.UUIDV1
    },
    username: {
      type: Sequelize.STRING,
      allowNull: true,
      comment: "发送人",
    },
    email: {
      type: Sequelize.STRING,
      allowNull: true,
      comment: "留言邮箱",
    },
    receive: {
      type: Sequelize.STRING,
      allowNull: true,
      comment: "接收人",
    },
    content: {
      type: Sequelize.TEXT,
      allowNull: true,
      comment: "留言内容",
    },
    roomId: {
      type: Sequelize.STRING,
      comment: '房间id',
      allowNull: true
  },
    isRoom: {
      type: Sequelize.STRING,
      comment: '是否群聊 1 群聊 0 私聊',
      allowNull: true
  },
    roomname: {
      type: Sequelize.STRING,
      comment: '房间名',
      allowNull: true
  }
  }, {
    tableName: "mg_msg", // 数据库表名
    // timestamps: true, // 默认开启 `createdAt` & `updatedAt`
  });
};
